<?php
namespace  app\admin\middlerware;

class Auth{
    public function handle($request, \Closure $next){
        // 前置中间件
        $request = $next($request);
        if(empty(session(config("admin.session_admin")))&& !preg_match("/login/", $request->pathinfo())){
            return redirect((string)url('login/index'));
        }

        return $next($request);

        //后置中间件
    }

    /**
     *
     * @param  \think\Response  $response
     */
   public function end(\think\Response $response){

   }
}